<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="CalculateRates.aspx.vb" Inherits="GTSWeb_Shipment_CalculateRates" title="GTS Frieght Management System"  MaintainScrollPositionOnPostback="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
    <h2>The Best Rates</h2>
<div style="">
    <p>
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" CellPadding="4"
            DataKeyNames="ReferenceNumber" DataSourceID="ShipmentSource" ForeColor="#333333"
            GridLines="None" Height="50px" Width="60%">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
            <EditRowStyle BackColor="#999999" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <EmptyDataTemplate>
                No shipments found.
            </EmptyDataTemplate>
            <Fields>
                <asp:BoundField DataField="ShipmentNumber" HeaderText="ShipmentNumber" SortExpression="ShipmentNumber" />
                <asp:TemplateField HeaderText="ShipmentDate" SortExpression="ShipmentDate">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ShipmentDate") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ShipmentDate") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("ShipmentDate", "{0:d}") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Weight" HeaderText="Weight" SortExpression="Weight" />
                <asp:TemplateField HeaderText="Service Type" SortExpression="ServiceTypeID">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("ServiceTypeID") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("ServiceTypeID") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:DropDownList ID="ddlServiceType" runat="server" BackColor="White" DataSourceID="ServiceType"
                            DataTextField="ServiceTypeName" DataValueField="ServiceTypeID" Enabled="False"
                            ForeColor="Black" SelectedValue='<%# Bind("ServiceTypeID") %>' Width="150px">
                        </asp:DropDownList><asp:ObjectDataSource ID="ServiceType" runat="server" OldValuesParameterFormatString="original_{0}"
                            SelectMethod="GetServiceType" TypeName="GTSSystem.BLL.ServiceType"></asp:ObjectDataSource>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                <asp:BoundField DataField="NrOfPieces" HeaderText="Total Items" SortExpression="NrOfPieces" />
                <asp:TemplateField HeaderText="Origin Address" SortExpression="OriginAddress">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("OriginAddress") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("OriginAddress") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <HeaderTemplate>
                        Origin Details
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("OriginAddress") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="OriginPostalCode" HeaderText="Postal Code" SortExpression="OriginPostalCode" />
                <asp:TemplateField HeaderText="Destination Address" SortExpression="DestinationAddress">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("DestinationAddress") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("DestinationAddress") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <HeaderTemplate>
                        Destination Details
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("DestinationAddress") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="DestinationPostalCode" HeaderText="Postal Code"
                    SortExpression="DestinationPostalCode" />
            </Fields>
            <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" Width="150px" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" Width="150px" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <HeaderTemplate>
                Shipment Details
            </HeaderTemplate>
        </asp:DetailsView>
    </p>
    <p>
        </p>
        <h5>Shipment Items</h5>
    <p>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
            DataKeyNames="ShipmentItemID" DataSourceID="ShipmentItems" ForeColor="#333333"
            GridLines="None" Width="60%">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <Columns>
                <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                <asp:BoundField DataField="Weight" HeaderText="Weight" SortExpression="Weight" />
                <asp:BoundField DataField="Length" HeaderText="Length" SortExpression="Length" />
                <asp:BoundField DataField="Height" HeaderText="Height" SortExpression="Height" />
                <asp:BoundField DataField="Width" HeaderText="Width" SortExpression="Width" />
            </Columns>
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <EditRowStyle BackColor="#999999" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        &nbsp;
    </p>
    <p>
    </p>
        </div>
    
        <h5>Rates</h5><asp:GridView ID="dgrRates" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False" PageSize="4" Width="100%">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" />
            <EditRowStyle BackColor="#999999" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField AccessibleHeaderText="CarrierID" DataField="CarrierID" HeaderText="CarrierID" Visible="False" />
                <asp:BoundField AccessibleHeaderText="Carrier Name" DataField="CarrierName" HeaderText="Carrier Name" />
                <asp:BoundField AccessibleHeaderText="Rate" DataField="Rate" HeaderText="Rate" />
                <asp:BoundField AccessibleHeaderText="GST" DataField="GST" HeaderText="GST" />
                <asp:BoundField AccessibleHeaderText="PST" DataField="PST" HeaderText="PST" />
                <asp:BoundField AccessibleHeaderText="HST" DataField="HST" HeaderText="HST" />
                <asp:BoundField AccessibleHeaderText="Surcharge" DataField="Surcharge" HeaderText="Surcharge" />
                <asp:BoundField AccessibleHeaderText="Total" DataField="Total"    HeaderText="Total" />
                <asp:BoundField AccessibleHeaderText="ReferenceNumber" DataField="ReferenceNumber"
                    HeaderText="ReferenceNumber" Visible="False" />
                <asp:HyperLinkField DataNavigateUrlFields="ReferenceNumber,CarrierID,Rate,GST,PST,HST,Surcharge,Total" DataNavigateUrlFormatString="~/GTSWeb/Shipment/FinalizeShipment.aspx?ReferenceNumber={0}&amp;CarrierID={1}&amp;Rate={2}&amp;GST={3}&amp;PST={4}&amp;HST={5}&amp;Surcharge={6}&amp;Total={7}"
                Text="Proceed.." />


            </Columns>
            </asp:GridView>
    <asp:Label ID="lblError" runat="server" Font-Size="Smaller"></asp:Label>
       
  
        <asp:ObjectDataSource ID="ShipmentSource" runat="server" InsertMethod="CreateShipment"
            OldValuesParameterFormatString="{0}" SelectMethod="getShipmentByReferencenumber"
            TypeName="GTSSystem.BLL.Shipment" UpdateMethod="UpdateShipment">
            <UpdateParameters>
                <asp:Parameter Name="ReferenceNumber" Type="Int32" />
                <asp:Parameter Name="Shipmentdate" Type="DateTime" />
                <asp:Parameter Name="ClientId" Type="Int32" />
                <asp:Parameter Name="ClientBranchid" Type="Int32" />
                <asp:Parameter Name="CarrierId" Type="Int32" />
                <asp:Parameter Name="Weight" Type="Double" />
                <asp:Parameter Name="Origin" Type="Int32" />
                <asp:Parameter Name="OriginAddress" Type="String" />
                <asp:Parameter Name="OriginPostalCode" Type="String" />
                <asp:Parameter Name="Destination" Type="Int32" />
                <asp:Parameter Name="DestinationAddress" Type="String" />
                <asp:Parameter Name="DestinationPostalCode" Type="String" />
                <asp:Parameter Name="ServicetTypeId" Type="Int32" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="GST" Type="Double" />
                <asp:Parameter Name="PST" Type="Double" />
                <asp:Parameter Name="HST" Type="Double" />
                <asp:Parameter Name="Surcharge" Type="Double" />
                <asp:Parameter Name="TotalPieces" Type="Int32" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="StatusId" Type="Int32" />
                <asp:Parameter Name="ShipmentNumber" Type="Int32" />
            </UpdateParameters>
            <SelectParameters>
                <asp:QueryStringParameter Name="ReferenceNumber" QueryStringField="ReferenceNumber"
                    Type="Int32" />
            </SelectParameters>
            <InsertParameters>
                <asp:Parameter Name="Shipmentdate" Type="DateTime" />
                <asp:Parameter Name="ClientId" Type="Int32" />
                <asp:Parameter Name="ClientBranchid" Type="Int32" />
                <asp:Parameter Name="CarrierId" Type="Int32" />
                <asp:Parameter Name="Weight" Type="Double" />
                <asp:Parameter Name="Origin" Type="Int32" />
                <asp:Parameter Name="OriginAddress" Type="String" />
                <asp:Parameter Name="OriginPostalCode" Type="String" />
                <asp:Parameter Name="Destination" Type="Int32" />
                <asp:Parameter Name="DestinationAddress" Type="String" />
                <asp:Parameter Name="DestinationPostalCode" Type="String" />
                <asp:Parameter Name="ServicetTypeId" Type="Int32" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="GST" Type="Double" />
                <asp:Parameter Name="PST" Type="Double" />
                <asp:Parameter Name="HST" Type="Double" />
                <asp:Parameter Name="Surcharge" Type="Double" />
                <asp:Parameter Name="TotalPieces" Type="Int32" />
                <asp:Parameter Name="UserName" Type="String" />
                <asp:Parameter Name="StatusId" Type="Int32" />
                <asp:Parameter Name="ShipmentNumber" Type="Int32" />
            </InsertParameters>
        </asp:ObjectDataSource>
        <asp:ObjectDataSource ID="ShipmentItems" runat="server" OldValuesParameterFormatString="{0}"
            SelectMethod="getAllShipmentItemsByReferenceNumber" TypeName="GTSSystem.BLL.ShipmentItems">
            <SelectParameters>
                <asp:QueryStringParameter Name="ReferenceNumber" QueryStringField="ReferenceNumber"
                    Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
    
</asp:Content>

